# test.py
import sys
import io
from gen import generate_data
from alg import longest_substring

# 中文输出支持（尤其是 Windows 控制台）
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')

if __name__ == "__main__":
    s, k = generate_data(length_range=(1, 10**4), k_range=(1, 10**5))
    print(f"生成的测试字符串长度：{len(s)}")
    print(f"生成的 k：{k}")
    result = longest_substring(s, k)
    print(f"满足条件的最长子串长度为：{result}")



